package com.mosai.alignpro.entity;

import android.graphics.drawable.Drawable;
import android.text.TextUtils;

import java.util.Objects;

/**
 * Created by Rays on 2020/3/9.
 */
public class RemoveAngleInfo {
    private float x;
    private float y;
    private int width;
    private int height;
    private double radiusPow;
    private Angle angle;
    private Point point;
    private final String id;

    public RemoveAngleInfo(float x, float y, Drawable removeImg, Angle angle, String id) {
        this(x, y, removeImg, angle, null, id);
    }

    public RemoveAngleInfo(float x, float y, Drawable removeImg, Point point, String id) {
        this(x, y, removeImg, null, point, id);
    }

    public RemoveAngleInfo(float x, float y, Drawable removeImg, Angle angle, Point point, String id) {
        if (TextUtils.isEmpty(id)) {
            throw new RuntimeException("id不能为空");
        }
        this.x = x;
        this.y = y;
        this.width = removeImg.getIntrinsicWidth();
        this.height = removeImg.getIntrinsicHeight();
        this.radiusPow = Math.pow(Math.max(this.width, this.height) / 2.0, 2);
        this.angle = angle;
        this.point = point;
        this.id = id;
    }

    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public double getRadiusPow() {
        return radiusPow;
    }

    public Angle getAngle() {
        return angle;
    }

    public void setAngle(Angle angle) {
        this.angle = angle;
    }

    public Point getPoint() {
        return point;
    }

    public void setPoint(Point point) {
        this.point = point;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RemoveAngleInfo)) return false;
        RemoveAngleInfo that = (RemoveAngleInfo) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
